#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>

int main()
{
    chdir("/home/dck/os/");
    FILE* fp = fopen("test.txt", "w");
    
    if(fp == NULL) perror("fopen fail\n");
    fclose(fp);

    int i = 0;
    while(i <= 100)
    { 
        pid_t id = getpid();
        pid_t pid = getppid();
        printf("我已经是一个进程了, myid: %d, parent id: %d\n", id, pid);
        sleep(1); 
    } 
    return 0; 
} 
